From 5b6313f16f508882a0ea67716b7dbaa1c6967f04 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 30 Jun 2025 08:28:13 +0000
Subject: (대표님) 20250630 16시 - 유저 도메인별 라우터 분리와 보안성검토 대응
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../engineering/(engineering)/pq_new/page.tsx      | 96 ++++++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 app/[lng]/engineering/(engineering)/pq_new/page.tsx

(limited to 'app/[lng]/engineering/(engineering)/pq_new/page.tsx')

diff --git a/app/[lng]/engineering/(engineering)/pq_new/page.tsx b/app/[lng]/engineering/(engineering)/pq_new/page.tsx
new file mode 100644
index 00000000..6598349b
--- /dev/null
+++ b/app/[lng]/engineering/(engineering)/pq_new/page.tsx
@@ -0,0 +1,96 @@
+import * as React from "react"
+import { Metadata } from "next"
+import { type SearchParams } from "@/types/table"
+import { getValidFilters } from "@/lib/data-table"
+import { Shell } from "@/components/shell"
+import { DataTableSkeleton } from "@/components/data-table/data-table-skeleton"
+import { searchParamsPQReviewCache } from "@/lib/pq/validations"
+import { getPQSubmissions } from "@/lib/pq/service"
+import { PQSubmissionsTable } from "@/lib/pq/pq-review-table-new/vendors-table"
+
+export const metadata: Metadata = {
+  title: "PQ 검토/실사 의뢰",
+  description: "",
+}
+
+interface PQReviewPageProps {
+  searchParams: Promise<SearchParams>
+}
+
+export default async function PQReviewPage(props: PQReviewPageProps) {
+  const searchParams = await props.searchParams
+  const search = searchParamsPQReviewCache.parse(searchParams)
+  const validFilters = getValidFilters(search.filters)
+
+  // 디버깅 로그 추가
+  console.log("=== PQ Page Debug ===");
+  console.log("Raw searchParams:", searchParams);
+  console.log("Raw basicFilters param:", searchParams.basicFilters);
+  console.log("Raw pqBasicFilters param:", searchParams.pqBasicFilters);
+  console.log("Parsed search:", search);
+  console.log("search.filters:", search.filters);
+  console.log("search.basicFilters:", search.basicFilters);
+  console.log("search.pqBasicFilters:", search.pqBasicFilters);
+  console.log("validFilters:", validFilters);
+
+  // 기본 필터 처리 (통일된 이름 사용)
+  let basicFilters = []
+  if (search.basicFilters && search.basicFilters.length > 0) {
+    basicFilters = search.basicFilters
+    console.log("Using search.basicFilters:", basicFilters);
+  } else if (search.pqBasicFilters && search.pqBasicFilters.length > 0) {
+    // 하위 호환성을 위해 기존 이름도 지원
+    basicFilters = search.pqBasicFilters
+    console.log("Using search.pqBasicFilters:", basicFilters);
+  } else {
+    console.log("No basic filters found");
+  }
+
+  // 모든 필터를 합쳐서 처리
+  const allFilters = [...validFilters, ...basicFilters]
+  
+  console.log("Final allFilters:", allFilters);
+  
+  // 조인 연산자도 통일된 이름 사용
+  const joinOperator = search.basicJoinOperator || search.pqBasicJoinOperator || search.joinOperator || 'and';
+  console.log("Final joinOperator:", joinOperator);
+
+  // Promise.all로 감싸서 전달
+  const promises = Promise.all([
+    getPQSubmissions({
+      ...search,
+      filters: allFilters,
+      joinOperator,
+    })
+  ])
+
+  return (
+    <Shell className="gap-4">
+      <div className="flex items-center justify-between space-y-2">
+        <div className="flex items-center justify-between space-y-2">
+          <div>
+            <h2 className="text-2xl font-bold tracking-tight">
+              PQ 검토/실사 의뢰
+            </h2>
+          </div>
+        </div>
+      </div>
+      
+      {/* Items처럼 직접 테이블 렌더링 */}
+      <React.Suspense 
+        key={JSON.stringify(searchParams)} // URL 파라미터가 변경될 때마다 강제 리렌더링
+        fallback={
+          <DataTableSkeleton
+            columnCount={8}
+            searchableColumnCount={2}
+            filterableColumnCount={3}
+            cellWidths={["10rem", "15rem", "12rem", "12rem", "8rem", "8rem", "10rem", "8rem"]}
+            shrinkZero
+          />
+        }
+      >
+        <PQSubmissionsTable promises={promises} />
+      </React.Suspense>
+    </Shell>
+  )
+}
\ No newline at end of file
-- 
cgit v1.2.3

